from sqlalchemy import Column, Integer, String, create_engine, Date
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

Base = declarative_base()


class UserInfo(Base):
    __tablename__ = 'user_info'
    user_id = Column(Integer, primary_key=True)
    user_name = Column(String(50))
    user_create_time = Column(String(50))
    user_pwd = Column(String(150))
    user_auth_id = Column(Integer, default=0)


class ShopInfo(Base):
    __tablename__ = 'shop_info'
    shop_id = Column(Integer, primary_key=True)
    shop_name = Column(String(50))
    shop_pwd = Column(String(150))
    shop_status = Column(Integer, default=0)


# 初始化数据库连接:
engine = create_engine('mysql+pymysql://apidb:19970405@moonwife.top:3306/apidb?charset=utf8', echo=True)
# 创建DBSession类型:
DBSession = sessionmaker(bind=engine)
session = DBSession()
Base.metadata.create_all(engine)
session.commit()
